package com.zsrt.java.day20161227.zsh.demo04;

import java.util.Arrays;	// Arrays.toString()	使用到包

/**
 * 已知：	54张扑克牌，三个玩家，留三张底牌分给地主
 * 求：	三个玩家拿到是什么牌，三张底牌又是什么
 * 分析：   1)玩家获取17张牌,使用随机数得到抽取牌的序号，玩家抽取一张牌，牌堆减少一张牌，
 * 		2）三个玩家各自得到17张牌以后，牌堆剩余三张，
 * 		3）创建四个数组，存放三个玩家得到的牌和牌堆的扑克牌，遍历发完牌后得到的四个数组元素，即是三个玩家拿到的牌和三张底牌
 * 
 */

public class DouDiZhu{
	public static void main(String[] args) {
		String[] poker={"黑桃A","红心A","梅花A","方块A","黑桃2","红心2","梅花2","方块2","黑桃3","红心3","梅花3","方块3","黑桃4","红心4","梅花4","方块4","黑桃5","红心5","梅花5","方块5","黑桃6","红心6","梅花6","方块6","黑桃7","红心7","梅花7","方块7","黑桃8","红心8","梅花8","方块8","黑桃9","红心9","梅花9","方块9","黑桃10","红心10","梅花10","方块10","黑桃J","红心J","梅花J","方块J","黑桃Q","红心Q","梅花Q","方块Q","黑桃K","红心K","梅花K","方块K","红JOKER","黑JOKER"};
		String[] wanjia01=new String[17];
		String[] wanjia02=new String[17];
		String[] wanjia03=new String[17];
		for(int c=0;c<17;c++){
			double r=Math.random()*(54-c);
			int index=(int)Math.floor(r);
			wanjia01[c]=poker[index];
			poker=ArrayQAUD.deleteNum(poker,poker[index]);
		}
		System.out.println("wanjia01的牌："+Arrays.toString(wanjia01));
		for(int c=0;c<17;c++){
			double r=Math.random()*(54-17-c);
			int index=(int)Math.floor(r);
			wanjia02[c]=poker[index];
			poker=ArrayQAUD.deleteNum(poker,poker[index]);
		}
		System.out.println("wanjia02的牌："+Arrays.toString(wanjia02));
		for(int c=0;c<17;c++){
			double r=Math.random()*(54-17-17-c);
			int index=(int)Math.floor(r);
			wanjia03[c]=poker[index];
			poker=ArrayQAUD.deleteNum(poker,poker[index]);
		}
		System.out.println("wanjia03的牌："+Arrays.toString(wanjia03));
		System.out.println("剩余三张底牌："+Arrays.toString(poker));
	}
}
